#include "Result.h"

Result::Result(std::shared_ptr<Task> task, bool isVaild)
	:_isVaild(isVaild),
	_task(task)
{
	_task->setResult(this);
}

void Result::setVal(Any any)
{
	this->_any = std::move(any);
	_sem.post();
}

Any Result::get()
{
	if (!_isVaild)
	{
		return "";
	}
	_sem.wait();
	return std::move(_any);
}



